<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>" type="text/css" />
		
	</head>
	<body style="">
		<div class="head_content" id="headBar" style=""></div>
		<div class="main_content" id="main">
			<form method="post" action="page_nav_save.html" id="nav_form">
				<input type="hidden" value="${systemNav.navId}" name="systemNav.navId" />

				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>

							<tr>
								<th>
									系统内容
								</th>
								<td>
									<select id="articleCatId" onchange="addNameAndUrl(this.value)" name="nameAndUrl" style="width: 100px;">
										<c:forEach var="lv" items="${lvs}" varStatus="index">
											<option value="${index.index}">
												${lv.label}
											</option>
										</c:forEach>
									</select>
								</td>
							</tr>
							<tr>
								<th>
									名称
								</th>
								<td>
									<input type="text" value="${systemNav.navName}" id="systemNav_nav_name" style="width: 320px;" name="systemNav.navName" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									链接地址
								</th>
								<td>
									<input type="text" value="${systemNav.url}" id="systemNav_url" style="width: 320px;" name="systemNav.url" class="x-input " />
									文章的链接地址dp_article_get.html?articleId=
								</td>
							</tr>
							<tr>
								<th>
									排序
								</th>
								<td>
									<input type="text" value="${systemNav.showOrder}" style="width: 320px;" name="systemNav.showOrder" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									是否显示
								</th>
								<td>
									<select id="show_on" name="systemNav.showOn" style="width: 100px;">
										<option value="true">
											是
										</option>
										<option value="false">
											否
										</option>
									</select>
								</td>
							</tr>
							<tr>
								<th>
									是否新窗口
								</th>
								<td>
									<select id="open_new_on" name="systemNav.openNewOn" style="width: 100px;">
										<option value="true">
											是
										</option>
										<option value="false">
											否
										</option>
									</select>
								</td>
							</tr>
							<tr>
								<th>
									位置
								</th>
								<td>
									<select id="nav_position" name="systemNav.navPosition" style="width: 100px;">
										<option value="top">
											顶部
										</option>
										<option value="middle">
											中间
										</option>
										<option value="buttom">
											底部
										</option>
									</select>
								</td>
							</tr>
						</tbody>
					</table>
				</div>


				<div class="table-action">
					<button class="btn" type="submit">
						<span><span><fmt:message key="button.save" /> </span> </span>
					</button>
				</div>
			</form>
		</div>
		<div class="foot_content" id="footBar" style="font-size: 0px;"></div>

<script type="text/javascript" src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/jquery.validate.js'/>"></script>
		<script type="text/javascript">	
	   
	
	 <c:if test="${not empty systemNav.navId}">
 	$('#show_on').attr('value','${systemNav.showOn}');
 	$('#open_new_on').attr('value','${systemNav.openNewOn}');
 	$('#nav_position').attr('value','${systemNav.navPosition}');
 </c:if>
 	
    function addNameAndUrl(nameKey)
{	 var sysm = new Object;
    <c:forEach var="lv" items="${lvs}" varStatus="index">
		
		sysm[${index.index}] = new Array();
        sysm[${index.index}][0] = '${lv.label}';
       	sysm[${index.index}][1] = '${lv.value}';
	</c:forEach>
     $('#systemNav_nav_name').attr('value',sysm[nameKey][0]);
     $('#systemNav_url').attr('value',sysm[nameKey][1]);
}


$(document).ready(function() {
 	var validator = $("#nav_form").validate({
		errorElement: "div" ,
		errorClass: "x-vali-error",
		onfocusout: false,
		rules: {
			'systemNav.navName' : "required" ,
			'systemNav.url' : "required" ,
			'systemNav.showOrder' : {
					required : true,
					number : true
			}
		},
		messages: {
 			'systemNav.navName' : "必填字段" ,
			'systemNav.url' : "必填字段" ,
			'systemNav.showOrder' : {
					required : "必填字段" ,
					number : "请输入数字" 
			}
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			element.removeClass('x-vali-error');
			error.appendTo( element.parent());
			
			
		},
 
		success: function(div) {	 
			$(div).remove();
		}
	});
});




</script>
	</body>
</html>